import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// element
import ElementUI from 'element-ui'
// dayjs
import dayjs from 'dayjs'

// 加载全局样式(包含element)
import './styles/index.scss'

// load plugin
Vue.use(ElementUI)

Vue.mixin({
  methods: {
    formatDate (date: Date | string) {
      return dayjs(date).format('YYYY-MM-DD HH:mm:ss')
    }
  }
})

Vue.config.productionTip = false
router.beforeEach((to, from, next) => {
  // console.log(to)
  // console.log(from)
  store.commit('setCurrentRouteMenus', to.matched)
  console.log(store.state.currentRouteMenus)
  next()
})
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
